package cn.fl.collection.transform;

import cn.cmm.base.framework.utils.CollectionUtils;
import cn.fl.collection.dto.RskCltAuthDTO;
import cn.fl.collection.dto.RskCltAuthRcvAplDTO;
import cn.fl.collection.vo.RskCltAuthRcvAplVO;
import cn.fl.collection.vo.RskCltAuthVO;
import org.springframework.beans.BeanUtils;

import java.util.ArrayList;
import java.util.List;

/**
 * @Description: 委外催收表 转换器
 * @Description: VO是客户端传递数据到服务端进行转换的数据
 * @Description: VO转换数据变成DTO传递到服务端
 * @Description: VO不能在服务端出现
 */
public class RskCltAuthRcvAplVOTransform {


    /**
     * DTO 转  VO
     *
     * @param dto RskCltAuthRcvAplDTO
     * @return RskCltAuthRcvAplVO
     */
    public static RskCltAuthRcvAplVO toVO(RskCltAuthRcvAplDTO dto) {
        RskCltAuthRcvAplVO vo = null;
        if (dto != null) {
            vo = new RskCltAuthRcvAplVO();
            BeanUtils.copyProperties(dto, vo);
        }
        return vo;
    }

    /**
     * VO 转 DTO
     *
     * @param vo RskCltAuthVO
     * @return RskCltAuthDTO
     */
    public static RskCltAuthRcvAplDTO toDTO(RskCltAuthRcvAplVO vo) {
        RskCltAuthRcvAplDTO dto = null;
        if (vo != null) {
            dto = new RskCltAuthRcvAplDTO();
            BeanUtils.copyProperties(vo, dto);
        }
        return dto;
    }

    /**
     * DTO集合 转 VO集合
     *
     * @param list
     * @return List<RskCltAuthVO>
     */
    public static List<RskCltAuthRcvAplVO> toVOList(List<RskCltAuthRcvAplDTO> list) {
        List<RskCltAuthRcvAplVO> voList = new ArrayList<RskCltAuthRcvAplVO>();
        if (CollectionUtils.isNotEmpty(list)) {
            for (RskCltAuthRcvAplDTO dto : list) {
                voList.add(toVO(dto));
            }
        }
        return voList;
    }

    /**
     * VO集合 转 DTO集合
     *
     * @param list List<RskCltAuthVO>
     * @return List<RskCltAuthDTO>
     */
    public static List<RskCltAuthRcvAplDTO> toDTOList(List<RskCltAuthRcvAplVO> list) {
        List<RskCltAuthRcvAplDTO> dtoList = new ArrayList<RskCltAuthRcvAplDTO>();
        if (CollectionUtils.isNotEmpty(list)) {
            for (RskCltAuthRcvAplVO vo : list) {
                dtoList.add(toDTO(vo));
            }
        }
        return dtoList;
    }

}
